export const filterEmptyProp = (obj = {}) =>
  Object.keys(obj).reduce((acc, key) => {
    if (obj[key] !== '' && obj[key] !== undefined) {
      acc[key] = obj[key];
    }
    return acc;
  }, {});

export const formatDate = (date) => {
  const d = new Date(date)
  return `${d.getFullYear()}-${formatDigit(d.getMonth() + 1)}-${formatDigit(d.getDate())}`
}

export const formatDigit = (n) => n > 9 ? n + '' : `0${n}`
